﻿using BlogDemo.Application.PostApp.Resource;
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;

namespace BlogDemo.Application.PostApp.Validation
{
    public class PostAddResourceValidator : AbstractValidator<PostAddResourceModel>
    {
        public PostAddResourceValidator()
        {
            RuleFor(x => x.Title).NotEmpty().WithMessage("Title不能为空且长度必须符合规则");
            RuleFor(x => x.Body).NotEmpty().WithMessage("Body不能为空");

            RuleFor(x => x.Author).NotEmpty().WithMessage("'{PropertyName}' is required.");
        }
    }
}
